import fetch from 'utils/fetch';
/* 结算管理*/
//查看结算列表

export function listSettlementAgentData(provinceId, cityId, areaId, applicationStartDate, applicationEndDate, status, headName, bankCardNumber, bankAccountName, page, rows) {
    const data = {
        provinceId,
        cityId,
        areaId,
        applicationStartDate,
        applicationEndDate,
        status,
        headName,
        bankCardNumber,
        bankAccountName,
        page,
        rows
    };
    return fetch({
        url: '/settlementAgent/listSettlementAgentData',
        method: 'post',
        data
    })
}

//昨日结算
export function getYesterdaySettlement() {
    const data = {

    };
    return fetch({
        url: '/settlementAgent/getYesterdaySettlement',
        method: 'post',
        data
    });
}

//查询区域代理
// export function listAgentProvinces(userId) {
//     const data = {
//         userId
//     };
//     return fetch({
//         url: '/settlementAgent/listAgentProvinces',
//         method: 'post',
//         data
//     });
// }

export function listAgentProvinces(userId) {
    const data = {

    };
    return fetch({
        url: '/settlementAgent/listAgentProvinces/' + userId,
        method: 'post',
        data
    });
}

//导出

export function exportSettlementAgentData(provinceId, cityId, areaId, applicationStartDate, applicationEndDate, status, headName, bankCardNumber, bankAccountName, AccessToken) {
    const params = {
        provinceId,
        cityId,
        areaId,
        applicationStartDate,
        applicationEndDate,
        status,
        headName,
        bankCardNumber,
        bankAccountName,
        AccessToken
    };
    return fetch({
        url: '/settlementAgent/exportSettlementAgentData',
        method: 'get',
        params
    });
}




//操作
export function updateSettlementInfo(cashId, pId, orgAccountId, status, reason) {
    const data = {
        cashId,
        pId,
        orgAccountId,
        status,
        reason
    };
    return fetch({
        url: '/settlementAgent/updateSettlementInfo',
        method: 'post',
        data
    });
}





//累计结算
export function getAccumulatedSum() {
    const data = {

    };
    return fetch({
        url: '/settlementAgent/getAccumulatedSum',
        method: 'post',
        data
    });
}

//批量完成
export function updateBatchSettlementInfo(batchPId) {
    const data = {
        batchPId
    };
    return fetch({
        url: '/settlementAgent/updateBatchSettlementInfo',
        method: 'post',
        data
    });
}



// 1. 统计结算金额
// settlement/countSettlementMoney
export function countSettlementMoney(provinceId, cityId, areaId, fSchoolId) {
    const data = {
        provinceId,
        cityId,
        areaId,
        fSchoolId
    };
    return fetch({
        url: '/settlement/countSettlementMoney',
        method: 'post',
        data
    });
}

// 2. 分页查询结算记录列表
// settlement/pageSettlement
export function pageSettlement(page, rows, provinceId, cityId, areaId, fSchoolId, sBeginTime, sEndTime, sStatus, sUserRealName, sCardNo) {
    const data = {
        page,
        rows,
        provinceId,
        cityId,
        areaId,
        fSchoolId,
        sBeginTime,
        sEndTime,
        sStatus,
        sUserRealName,
        sCardNo
    };
    return fetch({
        url: '/settlement/pageSettlement',
        method: 'post',
        data
    });
}

// 3. 导出结算记录列表
// settlement/exportSettlement
export function exportSettlement(sBeginTime, sEndTime, sStatus, token) {
    const params = {
        sBeginTime,
        sEndTime,
        sStatus,
        token
    };
    return fetch({
        url: '/settlement/exportSettlement',
        method: 'get',
        params
    });
}

// 4. 根据id查询结算记录
// settlement/getSettlementById
export function getSettlementById(pId) {
    const data = {
        pId
    };
    return fetch({
        url: '/settlement/getSettlementById',
        method: 'post',
        data
    });
}

// 5. 修改结算记录
// settlement/updateSettlement
export function updateSettlement(settlementIds, sStatus, sRemark) {
    const data = {
        settlementIds,
        sStatus,
        sRemark
    };
    return fetch({
        url: '/settlement/updateSettlement',
        method: 'post',
        data
    });
}

// 6. 分页查询结算明细列表
// settlement/pageSettlementDetail
export function pageSettlementDetail(page, rows, fSchoolId, sBeginTime, sEndTime) {
    const data = {
        page,
        rows,
        fSchoolId,
        sBeginTime,
        sEndTime
    };
    return fetch({
        url: '/settlement/pageSettlementDetail',
        method: 'post',
        data
    });
}

// 7. 导出结算区间充值明细列表
// settlement/exportSettlementDetail
export function exportSettlementDetail(fSchoolId, sBeginTime, sEndTime, token) {
    const params = {
        fSchoolId,
        sBeginTime,
        sEndTime,
        token
    };
    return fetch({
        url: '/settlement/exportSettlementDetail',
        method: 'get',
        params
    });
}

// 8. 查询统计收入金额
// settlement/countIncomeSettlementDetail
export function countIncomeSettlementDetail(provinceId, cityId, areaId, fSchoolId) {
    const data = {
        provinceId,
        cityId,
        areaId,
        fSchoolId
    };
    return fetch({
        url: '/settlement/countIncomeSettlementDetail',
        method: 'post',
        data
    });
}

// 9. 分页查询充值收入
// settlement/pageIncomeSettlementDetail
export function pageIncomeSettlementDetail(page,rows,provinceId,cityId,areaId,fSchoolId,beginDate,endDate,sPipelineType,sPaymentMethod) {
    const data = {
        page,
        rows,
        provinceId,
        cityId,
        areaId,
        fSchoolId,
        beginDate,
        endDate,
        sPipelineType,
        sPaymentMethod
    };
    return fetch({
        url: '/settlement/pageIncomeSettlementDetail',
        method: 'post',
        data
    });
}

// 10. 导出充值收入列表
// settlement/exportIncomeSettlementDetail
export function exportIncomeSettlementDetail(provinceId, cityId, areaId, fSchoolId, beginDate, endDate, sPipelineType, sPaymentMethod, token) {
    const data = {
        provinceId, 
        cityId, 
        areaId, 
        fSchoolId, 
        beginDate, 
        endDate, 
        sPipelineType, 
        sPaymentMethod, 
        token
    };
    return fetch({
        url: '/settlement/exportIncomeSettlementDetail',
        method: 'post',
        data
    });
}

// 11. 分页查询消费支出明细
// settlement/pageExpenseSettlementDetail
export function pageExpenseSettlementDetail(page, rows, fSchoolId, beginDate, endDate) {
    const data = {
        page, 
        rows, 
        fSchoolId, 
        beginDate, 
        endDate
    };
    return fetch({
        url: '/settlement/pageExpenseSettlementDetail',
        method: 'post',
        data
    });
}

// 模糊搜索学校
export function querySchoolByName(schoolName) {
    const data = {
        schoolName
    };
    return fetch({
        url: '/school/querySchoolByName',
        method: 'post',
        data
    });
}

//当前结算信息
export function getSettlementAgentData(pId) {
    const data = {
        pId
    };
    return fetch({
        url: 'settlementAgent/getSettlementAgentData',
        method: 'post',
        data,
    });
}

//结算区间明细接口
export function listPayIncrementDetailInfo(page,rows,intervalStartTime,intervalEndTime,pId) {
    const data = {
        page,
        rows,
        intervalStartTime,
        intervalEndTime,
        pId
    };
    return fetch({
        url: 'settlementAgent/listPayIncrementDetailInfo',
        method: 'post',
        data,
    });
}

//结算区间明细接口
export function exportPayIncrementDetailInfo(page,rows,intervalStartTime,intervalEndTime) {
    const data = {
        page,
        rows,
        intervalStartTime,
        intervalEndTime
    };
    return fetch({
        url: 'settlementAgent/exportPayIncrementDetailInfo',
        method: 'post',
        data,
    });
}

// 1. 分页查询会员订单
export function listMembershipPayDetailInfo(page, rows, intervalStartTime, intervalEndTime, userId) {
    const data = {
        page,
        rows,
        intervalStartTime,
        intervalEndTime,
        userId
    };
    return fetch({
        url: '/settlementAgent/listMembershipPayDetailInfo',
        method: 'post',
        data
    });
}

// 1. 分页查询打包订单
export function pageMembershipPackPayDetailInfo(page, rows, startDate, endDate, fOrgUserId) {
    const data = {
        page,
        rows,
        startDate,
        endDate,
        fOrgUserId
    };
    return fetch({
        url: 'settlementAgent/pageMembershipPackPayDetailInfo',
        method: 'post',
        data
    });
}

// 1. 分页查询打包订单
export function pageOrderDetail(page, rows, startDate, endDate, orgUserId) {
    const data = {
        page,
        rows,
        startDate,
        endDate,
        orgUserId
    };
    return fetch({
        url: 'orderDetail/pageOrderDetail',
        method: 'post',
        data
    });
}